//
//  UIView+IBInsepectable.swift
//  01.XinLangWB
//
//  Created by xiaoyudong on 16/4/7.
//  Copyright © 2016年 苏小样. All rights reserved.
//

import UIKit
extension UIView{
    @IBInspectable var cornerRadius: CGFloat{
        get{
            return layer.cornerRadius
        }
        set{
           layer.cornerRadius = newValue
            if newValue > 0{
                layer.masksToBounds = true
            }else{
                layer.masksToBounds = false
            }
        }
    }
    //线宽
    @IBInspectable var borderWidth: CGFloat{
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
            
        }
    }
    //颜色
    @IBInspectable var borderColor: UIColor?{
        get{
            if let c = layer.borderColor{
            return UIColor(CGColor: c)
            }
            return nil
        }
        set{
            layer.borderColor = newValue?.CGColor
            
        }
    }
}
